﻿<cfsilent>
	<cfscript>
	
	dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
	propAdvice = getProperty("serviceFactory").getBean("termPropertyAdvice");

	sql = "	SELECT
				t.term_id,t.academic_year,t.academic_term,t.term_prop
			FROM
				t_term t
			WHERE
				SUBSTR(t.term_prop,1,1) = '1'
				OR
				SUBSTR(t.term_prop,2,1) = '1'
			ORDER BY
				t.term_id";
	
	queryObj = new Query(datasource = application.dnsSlave);
	rs_term = queryObj.execute(sql = sql).getResult();
	
	if ( rs_term.recordCount eq 0 ) {
		
		sql = "	SELECT
					t.term_id,t.academic_year,t.academic_term,t.term_prop
				FROM
					t_term t
				WHERE
					SUBSTR(t.academic_year,1,4) > :yearStart 
					AND
					SUBSTR(t.academic_year,1,4) < :yearEnd 
				ORDER BY
					t.term_id";
		
		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam(name = "yearStart", value = (year(now())-2), cfsqltype="cf_sql_char");
		queryObj.addParam(name = "yearEnd", value = (year(now())+1), cfsqltype="cf_sql_char");
		rs_term = queryObj.execute(sql = sql).getResult();
		
	}

	</cfscript>
</cfsilent>

<div class="noticeBlock">
	<h3>选择学年学期</h3>
	<p><span class="img icon16x16 message"></span>通常课程教学安排会在学期开始前进行, 排课中有 "当前学期" 和 "选课学期" 两个不同的时间概念. 请选择您当前要操作的学年学期.</p>
	<ol>
		<cfloop query="rs_term">
			<cfset propAdvice.parseProperty(rs_term.term_prop) />		
			<li class="friendly">
				<span class="img icon10x10 execute"></span>
				<a rowid="<cfoutput>#rs_term.term_id#</cfoutput>" href="<cfoutput>#buildURL( event.getName(), {TID=rs_term.term_id})#</cfoutput>"><cfoutput>#rs_term.academic_year#</cfoutput>学年 - <cfoutput>#dictAdvice.getTerm(rs_term.academic_term)#</cfoutput></a>
				<span><cfif propAdvice.getRunning()>(当前学期)</cfif></span>
			</li>

		</cfloop>
	</ol>
</div>